package clases;

import java.util.ArrayList;
import java.util.List;

import es.deusto.ingenieria.is.csp.formulation.Constraint;
import es.deusto.ingenieria.is.csp.formulation.Variable;

public class Alldiff extends Constraint<Integer> {

	public Alldiff(String name, List<Variable<Integer>> variables) {
		super(name, variables);
	}

	@Override
	public boolean isSatisfied(Variable<Integer> var, Integer valueToAssign) {
		List<Variable<Integer>> variables = new ArrayList<Variable<Integer>>();
		variables = super.getVariables();
		for (Variable<Integer> variable : variables) {
			if (variable.getValue().equals(valueToAssign) && !variable.equals(var)) {
				return false;
			}
		}
		return true;
	}

	@Override
	public String toString() {
		return null;
	}

}
